package com.zhang.crm.controller;

import com.github.pagehelper.PageInfo;
import com.zhang.crm.pojo.TTran;
import com.zhang.crm.result.R;
import com.zhang.crm.service.TranService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class TranController {

    @Resource
    private TranService tranService;
    @GetMapping("api/loadTranList")
    public R loadTranList(@RequestParam("current")Integer current){
        PageInfo<TTran> tranListByPage = tranService.getTranListByPage(current);
        return R.OK(tranListByPage);
    }

    @GetMapping("api/tranDetail/{tranId}")
    public R getTranDetail(@PathVariable("tranId")Integer tranId){
        TTran tTran = tranService.getTranDetail(tranId);
        return R.OK(tTran);
    }
}
